package com.yueqianshop.product.feign;

import com.yueqianshop.common.to.SkuReductionTo;
import com.yueqianshop.common.to.SpuBoundTo;
import com.yueqianshop.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@FeignClient("yueqianshop-coupon")
@Component
public interface CouponFeignService {
    /*
    *  1、@RequestBody将这个对象转成JSON
    *  2、找到yueqianshop-coupon这个服务，给/coupon/spubounds/save发送请求
    *     将上一步的JSON放在请求体位置，发送请求
    *  3、对方服务收到请求，请求体里有JSON数据。
    *     (@RequestBody SpuBoundTo spuBoundTo),将请求体JSON转为SpuBoundsEntity
    * 只要JSON数据模型是兼容的，双方服务无需使用同一个to
    *
    *
    *
    * */

    @PostMapping("/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);


    @PostMapping("/coupon/skufullreduction/saveinfo")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
